This version ODF supports the RequestEmbeddedFrame API for both container and embedded parts. ODFDraw and ODFBitmap implement this API for embedding and embedded parts, respectively.
Embedding Parts
• Required API
As an embedding part, you need to override two methods in order to support RequestEmbeddedFrame:
frameShape: the suggested frame shape for the new frame (in frame coordinates of baseFrame)
embeddedPart: the embedded part requesting a new frame
viewType: the view type for the new frame
presentation: the presentation for the new frame
frameGroupID: the group ID for the new frame
isOverlaid: tells you if the new frame should be an overlaid frame
isSubFrame: tells you if the new frame should be a subframe
By default FW_CEmbeddingFrame::EmbeddedFrameRequested returns NULL meaning that RequestEmbeddedFrame is not supported. This is the case for example with the ODFEmbed part (only one frame can be embedded).
If your part wants to allow embedded parts to request additional frames you need to override CEmbeddingFrame::EmbeddedFrameRequested. In your override first create a new proxy object and then call FW_CPresentation::Embed to create the new frame.
Here is an example taken from ODFDraw. Notice that in this example ODFDraw doesn't care about the suggested frame shape but force the requested frame to be the same size as the base frame.
in the same way that an embedded part can request an additional frame, it can ask you (the embedding part) to remove a previously requested frame. The API is:
ODF usually takes care of the Group ID and Sequence number. You cannot change the group ID but you can change the sequence number if necessary. The following API is available in FW_MProxy:
If your containing part does not support RequestEmbeddedFrame, RequestSiblingFrame will return kODNULLID. You need to test for that, since not all embedding parts will support RequestEmbeddedFrame.
myPresentation->Invalidate(ev, NULL, sequence); // invalidate all frames of this sequence
break;
}
.....
default:
result = FALSE;
}
return result;
}
2) FW_CPresentation::RemoveSiblingFrame
When you no longer need a frame you have requested, call FW_CPresentation::RemoveSiblingFrame. Note that in the OpenDoc documentation it is mentioned that only requested frames can be removed. ODF will post an assert if you try to remove a frame you haven't requested.